package com.qfedu.edu.iotserver.controller;


import com.qfedu.edu.iotserver.service.UserService;
import com.qfedu.edu.pojo.User;
import com.qfedu.edu.result.R;
import com.qfedu.edu.vo.LoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 管理员用户表 前端控制器
 * </p>
 *
 * @author xiaobobo
 * @since 2024-09-13
 */
@RestController
@RequestMapping("/iotserver/user")
@Api(description = "用户模块",tags = "用户模块")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("list")
    @ApiOperation("查询所有的用户")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token",value = "用户令牌",required = true,dataType = "string",paramType = "header"),
            @ApiImplicitParam(name = "sign",value = "当前时间",required = true,dataType = "int",paramType = "header")
    })
    public R list(){
        List<User> list = userService.list(null);
        return R.ok().data("userList",list);
    }


    /**
     * 登陆接口
     * @param loginVo
     * @return
     */
    @PostMapping("/login")
    @ApiOperation("登陆接口")
    public R login(@RequestBody LoginVo loginVo){
        return R.ok();
    }


    /**
     * 登出接口
     * @return
     */
    @GetMapping("/logout")
    @ApiImplicitParam(name = "token",value = "用户令牌",required = true,dataType = "string",paramType = "header")
    @ApiOperation("退出接口")
    public R logout(){
        return R.ok();
    }
}

